package gui.domain;

import java.awt.GridLayout;

import javax.swing.JPanel;

import logic.GameviewLogic;
import logic.pieces.IPlacePiece;

public class Gameview extends JPanel implements IPlacePiece {

	private GameviewLogic logic = new GameviewLogic();

	// tegne brettet
	public Gameview() {
		setLayout(new GridLayout(ROWS, 0));
		for (int i = 0; i < 64; i++) {
			add(new Square(i));
		}
	}

	public Square getSqareInFront(int n) {
		return getField(logic.getSquareInFront(n));
	}

	public boolean isMyTurn(String color) {
		return logic.isMyTurn(color);
	}

	public void changePlayer() {
		logic.changePlayer();
	}

	public void removeMoveableTo() {
		for (int i = 0; i < 64; i++) {
			getField(i).removeMoveableTo();
		}
	}

	private Square getField(int i) {
		return (Square) getComponent(i);
	}

	
}
